package com.cy.pj.brand.dao;

import com.cy.pj.brand.pojo.Brand;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BrandDao {
    /**
     * 基于name值的不同，可能需要如下两种sql实现
     * select * from tb_brand;
     * select * from tb_brand where name like concat("%",#{name},"%");
     * @param name
     * @return
     */
    List<Brand> findBrands(String name);

    int insertBrand(Brand brand);

    @Select("select id,name,remark,createdTime from tb_brand where id=#{id}")
    Brand findById(Integer id);

    @Update("update tb_brand set name=#{name},remark=#{remark} where id=#{id}")
    int updateBrand(Brand brand);
}
